package com.ita.comdept.impl;

import java.rmi.RemoteException;

import com.ita.command.Command;
import com.ita.dao.DepartmentDao;
import com.ita.dao.PeopleDao;
import com.ita.po.Department;
import com.ita.po.People;
import com.ita.po.ReturnValue;

public class CmdOneDept implements Command {
	
	private DepartmentDao departmentDao;
	private Department department;

	
	public CmdOneDept(DepartmentDao departmentDao,Department department) {
		super();
		this.departmentDao =departmentDao;
		this.department = department;
	}


	@Override
	public ReturnValue execute() throws RemoteException {
		Department dept = departmentDao.loadDepartment(department.getDeptId());
		System.out.println(dept.toString());
		for(People p : dept.getpList())
			System.out.println(p.toString());
		System.out.println("Select Success!");
		ReturnValue returnValue = new ReturnValue();
		returnValue.setDepartment(dept);
		return returnValue;
	}

}
